<?php include 'CheckSession.php'; ?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>后台管理</title>
    <link href="css/style.css" rel="stylesheet" type="text/css"/>
    <meta http-equiv="refresh" content="5;URL=Admin_Booklist.php">
</head>
<body>

<table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td height="50" align="center" class="title">会员列表</td>
    </tr>
</table>
<div>&nbsp;</div>
<table width="100%" border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse">
    <tr>
        <td>
            <table border="1" width="100%" id="table1" bordercolorlight="#000000" cellspacing="0" cellpadding="0"
                   height="100%">
                <tr>
                    <td height=35 align="center"><b><font color="#0000FF" size="4">编号</font></b></td>
                    <td width="120" align="center"><b><font color="#0000FF" size="4">账号</font></b></td>
                    <td width="120" align="center"><b><font color="#0000FF" size="4">密码</font></b></td>
                    <td width="100" align="center"><b><font color="#0000FF" size="4">开户名</font></b></td>
                    <td width="140" align="center" width="134"><b><font color="#0000FF" size="4">联系电话</font></b></td>
                    <td width="120" align="center"><b><font color="#0000FF" size="4">提款密码</font></b></td>
                    <td width="120" align="center"><b><font color="#0000FF" size="4">开户日期</font></b></td>
                    <td width="120" align="center"><b><font color="#0000FF" size="4">Email</font></b></td>
                    <td width="70" align="center"><b><font color="#0000FF" size="4">修改</font></b></td>
                    <td width="70" align="center"><b><font color="#0000FF" size="4">删除</font></b></td>
                    <td width="70" align="center"><b><font color="#0000FF" size="4">审核</font></b></td>
                </tr>
                <?php

                $con = mysql_connect("localhost", "root", "");
                if (!$con) {
                    die('Could not connect: ' . mysql_error());
                }
                $pagesize = 10;
                mysql_select_db("my_db", $con);
                $rs = mysql_query("select count(*) from Person", $con);
                $myrow = mysql_fetch_array($rs);
                $numrows = $myrow[0];
                $pages = intval($numrows / $pagesize);
                if ($numrows % $pagesize) {
                    $pages++;
                }

                if (isset($_GET['page'])) {
                    $page = intval($_GET['page']);
                } else {
                    $page = 1;
                }
                $offset = $pagesize * ($page - 1);
                $result = mysql_query("SELECT * FROM Person ORDER BY `PersonID` DESC limit $offset,$pagesize");

                for ($i = 0; $i < $pagesize; $i++) {
                    $row = mysql_fetch_array($result);
                    if ($row['Checked'] == 0) {
                        $Code = "<a href='updateChecked.php?Id=$row[PersonID]&page=$page'><font size='4' color=blue><b>审核</b></font></a>";
                    } else {
                        $Code = "<font size='4' color=black><b>已审核</b></font>";
                    }
                    ?>
                    <tr>
                        <td height=35 align="center"><font size="4"><?php echo $row['PersonID'] ?></font></td>
                        <td align="center"><font size="4"><?php echo $row['UserName'] ?></font></td>
                        <td align="center"><font size="4"><?php echo $row['Password'] ?></font></td>
                        <td align="center"><font size="4"><?php echo $row['RealName'] ?></font></td>
                        <td align="center" width="134"><font size="4"><?php echo $row['Phone'] ?>&nbsp;</font></td>
                        <td align="center"><font size="4"><?php echo $row['DrawPwd'] ?>&nbsp;</font></td>
                        <td align="center"><font size="4"><?php echo $row['Time'] ?></font></td>
                        <td align="center"><font size="4"><?php echo $row['Ly'] ?></font></td>
                        <td align="center"><a
                                href='Edit.php?id=<?php echo $row['PersonID'] ?>&page=<?php echo $page ?>'><font
                                    size="4" color=blue><b>修改</b></font></a></td>
                        <td align="center"><a
                                href="deleteuser.php?Id=<?php echo $row['PersonID'] ?>&page=<?php echo $page ?>"><font
                                    size="4" color=blue><b>删除</b></font></a></td>
                        <td align="center"><?php echo $Code ?></td>
                    </tr>
                <?php
                }
                ?>
            </table>
        </td>

    </tr>
    <?php
    echo "<tr>";
    for ($i = 1; $i <= $pages; $i++) {
        echo "<a href='?page=$i'>[$i]</a>";
    }
    echo "</tr>";
    ?>
    <tr>
        <td colspan="2"></td>
    </tr>
    <?php
    mysql_close($con);
    ?>
</table>
</body>
</html>